package rw.ac.kiosc.jdbc.school.orm;

import java.io.Serializable;
import org.w3c.dom.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author antoine
 */
public class User implements Serializable {

    private int userId;
    private String username;
    private String hashedPassword;
    private String name;

    public User() {
    }

    public User(String username, String hashedPassword, String name) {
        this.username = username;
        this.hashedPassword = hashedPassword;
        this.name = name;
    }

    public User(int userId, String username, String hashedPassword, String name) {
        this.userId = userId;
        this.username = username;
        this.hashedPassword = hashedPassword;
        this.name = name;
    }

    public String getHashedPassword() {
        return hashedPassword;
    }

    public void setHashedPassword(String hashedPassword) {
        this.hashedPassword = hashedPassword;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Node getUserNode(Document document) {
        Element studentNode = document.createElement("user");
        studentNode.setAttribute("userId", getUserId() + "");
        studentNode.setAttribute("username", this.getUsername());
        studentNode.setAttribute("name", this.getName() + "");
        return studentNode;
    }
}
